package tylerp.dnd.util;

public class Random extends java.util.Random {

    /**
     * This constructor creates a better seed by not relying solely on time
     * for its creation.
     */
    public Random() {
        super(new java.util.Random().nextLong());
    }

    /**
     * This method returns a random int between 1 (inclusive)
     * and max (inclusive).
     * What makes this method special is it discards a random amount of rolls
     * in an effort to increase randomness.
     * @param max an int representing the maximum value
     * @return an int representing the random number
     */
    @Override
    public int nextInt(int max) {
        for (int i = 0; i < super.nextInt(50) + 50; i++) {
            super.nextInt(max);
        }

        return super.nextInt(max) + 1;
    }
}

